﻿<%@ Page Title="" Language="C#" MasterPageFile="~/App_form/Menu/dao_tao.master" AutoEventWireup="true" CodeFile="dky_lich_hoc.aspx.cs" Inherits="f_dky_lich_hoc" %>

<%@ Register TagPrefix="Control" TagName="menu_phai" Src="~/App_ctr/Admin/menu_phai.ascx" %>

<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <div style="width: 100%">
        <div style="width: 20%; float: left;">
            <Control:menu_phai runat="server" ID="menuphai" />
        </div>
        <div style="width: 79.4%; float: right;">
            <div style="background-image: url(../../CSS/images/ui-bg_glass_75_e6e6e6_1x400.png); font-weight: bold; height: 30px; border: 1px solid #d3d3d3; margin-top: 4px; text-align: center; padding-top: 8px; text-transform: uppercase;">
                ĐĂNG KÝ LỊCH HỌC
            </div>
            <div style="margin-top: 2px;">
                <div style="display: table; margin: 0 auto; width: 100%; border: 1px solid #d3d3d3; font-size: 16px; padding-bottom:5px;">
                    <div id="ndung_ct" class="clearfix">
                        <div style="width: 39%; float: left; padding: 50px;">
                            <div style="width:84%; float:right;">
                                <div style="float: left; width: 20%;">
                                    <label>
                                        Năm học  :
                                    </label>
                                </div>
                                <div style="float: left; width: 70%">
                                    <Lib:drop runat="server" ID="namhoc" DataTextField="TEN" DataValueField="MA" Width="247px" Height="30px" onClientChange="PDT_DK_LICH_LOP()"></Lib:drop>
                                </div>
                                <div style="width: 100%; height: 6px; float: left;"></div>
                                <div style="float: left; width: 20%;">
                                    <label>
                                        Học kỳ :
                                    </label>
                                </div>
                                <div style="float: left; width: 70%">
                                    <Lib:drop runat="server" ID="hocky" DataTextField="TEN" DataValueField="MA" Width="248px" Height="23px" onClientChange="PDT_DK_LICH_LOP()"></Lib:drop>
                                </div>
                                <div style="width: 100%; height: 6px; float: left;"></div>
                                <div style="width: 100%; height: 6px; float: left;"></div>
                                <div style="float: left; width: 90%; margin-left: 50px;">
                                    <Lib:Button runat="server" ID="tim" Icon="OK" Text="Đăng ký" Width="100px" onClientClick="P_DKY_LICH_HOC_NH()"></Lib:Button>
                                </div>
                            </div>
                        </div>
                        <div style="width: 38%; float: left;">
                            <Lib:gridView runat="server" ID="dk_hoc" Width="400" Height="300">
                                <Columns>
                                    <Lib:Column BaseColumn="ten" Name="Tên" Width="300" />
                                    <Lib:Column BaseColumn="CHON" Name="ĐK" Width="80" EditControlType="CheckBox" />
                                </Columns>
                                <Pager>
                                    <Lib:Pager PageSize="10" />
                                </Pager>
                            </Lib:gridView>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <asp:HiddenField ID="kthuoc" runat="server" Value="0,0" />

    <script>
        //
        
        //KKHOA LOP
        function PDT_DK_LICH_LOP() {
            try {
                b_nam = $("#<%=namhoc.ClientID%>").val();
                if (Common.NVL(b_nam, "") == "")
                    b_nam = 0.0;
                var nam = $("#<%=namhoc.ClientID%>").val(), b_hk = $("#<%=hocky.ClientID%>").val();
                wdt_ma.FDT_DK_LICH_HOC_LKE(nam, b_hk, P_LOP_LKE_KQ, ErrorDb, ErrorTimeOut);
                return true;
            }

            catch (err) {
                ShowError(err);
            }
        }
        function P_LOP_LKE_KQ(b_kq) {
            if (CheckError(b_kq)) {
                ShowError(b_kq);
                return;
            }
            var grid = GetGridByID("<%=dk_hoc.ClientID%>");
            grid.dataBin(b_kq);
            return false;
        }
        
        //khóa sổ
        function P_DKY_LICH_HOC_NH()
        {
            try
            {
                var nam = $("#<%=namhoc.ClientID%>").val(), b_hk = $("#<%=hocky.ClientID%>").val();
                var a_data = GetGridByID("<%=dk_hoc.ClientID%>").getData();
                if(a_data.length==0)
                {
                    Msg.Show("Thông báo", "Chưa chọn giá trị", "info");
                    return;
                }
                var b_lop = new Array(), b_chon = new Array(), a_ten_lop = new Array();
                for (var i = 0; i < a_data.length; i++)
                {
                    if(a_data[i].TEN !="")
                    {
                        b_lop[i] = a_data[i].LOP_ID;
                        b_chon[i] = a_data[i].CHON.toString();
                        a_ten_lop[i] = a_data[i].TEN;
                    }
                }
                wdt_ma.FDT_TKB_DKY_HOC(nam, b_hk, b_lop, a_ten_lop, b_chon, P_KHOA_SO_KQ, ErrorDb, ErrorTimeOut);
            }
            catch(err)
            {
                ShowError(err);
            }
        }
        function P_KHOA_SO_KQ(b_kq)
        {
            if (CheckError(b_kq)) {
                ShowError(b_kq);
                return;
            }
            Msg.Show("Thông báo", "Đăng ký thành công");
        }
    </script>
</asp:Content>

